package com.cl.security.core.entity;

import com.cl.security.base.entity.BaseEntity;
import com.cl.security.system.entity.FileInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;

@Entity
@Table(name = "mall_property_value")
@Getter
@Setter
@SQLDelete(sql = "update mall_property_value set deleted=1 where id=?")
@Where(clause = "deleted<>1")
public class PropertyValue extends BaseEntity {
    @ManyToOne
    @JoinColumn(name = "property_id",insertable = false,updatable = false)
    private Property property;

    @ManyToOne
    @JsonIgnoreProperties({"propertyValues"})
    @JoinColumn(name = "product_id",insertable = false,updatable = false)
    private Product product;

    @OneToOne(cascade = CascadeType.ALL,orphanRemoval = true)
    private FileInfo image;

    @Column(name = "property_id")
    private Long propertyId;
    @Column(name = "product_id")
    private Long productId;


    
}
